<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>页面控制台 - WingsJ</title>

  <style>
    html {
      font-size: 20px;
      font-family: 'Microsoft Jhenghei';
    }

    body {
      padding: 4rem;
    }
  </style>
  <script type="module">
    import Stats from './lib/stats.module.js';
    import { GUI } from './lib/dat.gui.module.js';

    window.Control={}

    const AnimationArray = [ // 需要周期调用的函数添加到这个数组中
      () => {
        window.requestAnimationFrame(timestamp => {
          for (let el of AnimationArray) {
            el(timestamp)
          }
        })
      }
    ]
    window.Control.AnimationArray = AnimationArray

    const stats = new Stats()
    AnimationArray.push(() => {
      stats.update()
    })
    const gui = new GUI();
    window.Control.GUI = gui

    document.addEventListener('DOMContentLoaded', () => {
      document.body.appendChild(stats.dom)
      window.requestAnimationFrame(AnimationArray[0])
    })
  </script>
</head>

<body>
  <script type="module">
    let param = {
      a: 1
    }
    for (let key in param) {
      Control.GUI.add(param, key)
    }

  </script>
</body>

</html>